﻿$(document).ready(function () {

    $("#btnAdminLogin").click(function () {

        Login();

    });

    $(document).keyup(function (event) {
        if (event.keyCode == 13) {
            Login();
        }
    });


});
function Login() {

    if ($("#txtUserName").val() == "") {
        alert("请输入管理员用户名");
        return false;
    }
    if ($("#txtPassword").val() == "") {
        alert("请输入密码");
        return false;
    }

    $.ajax({
        url: "/Admin/adminloginCheck",
        type: 'POST',
        data: { "name": "" + $("#txtUserName").val() + "", "password": "" + $("#txtPassword").val() + "" },
        dataType: 'json',
        success: function (data) {

            if (data["Success"]) {

                window.location = "/admin/index";

            }
            else {

                alert(data["info"]);
                return false;
            }


        }
    });
}